home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- global proc int dwgExportOptions ( string $parent, string $action, string $initialSettings, string $resultCallback )
- //
- // Description:
- // This script posts the ODWG file translator options.
- // The optionsString is of the form:
- // varName1=value1;varName2=value2;...
- //
- // Parameters:
- // $parent - the elf parent layout for this options layout. It is
- // always a scrollLayout.
- // $action - the action to be performed when this method is invoked.
- // Valid options are:
- // "query" - construct the options string and
- // pass it to the resultCallback.
- // "post" - post all the elf controls.
- // $initialSettings - the current options string in effect at the
- // time this script is invoked.
- // $resultCallback -
- // This is the proc to be called with the result string.
- // resultCallback ( string $optionsString )
- //
- // Returns:
- // 1 if successfull.
- // 0 otherwise.
- //
- {
- int $bResult;
- string $currentOptions;
- string $optionList[];
- string $optionBreakDown[];
- int $index;
-
-
-
-
- if ($action == "post") {
- setParent $parent;
-
- columnLayout -adj true -cal left odwgTypeCol;
- text -label "";
- // File Version Drop-Down Menu Box
-
- optionMenuGrp -label "Output file format" -cc updatedwgUnitsEnabled fileVersion;
- menuItem -label "ACAD25" ;
- menuItem -label "ACAD26" ;
- menuItem -label "ACAD9 " ;
- menuItem -label "ACAD10" ;
- menuItem -label "ACAD11" ;
- menuItem -label "ACAD13" ;
- menuItem -label "ACAD14" ;
- menuItem -label "ACAD2000" ;
- setParent ..;
- //space
- text -label "";
-
-
-
- optionMenuGrp -label "Units" -en false units;
- menuItem -label "Unitless";
- menuItem -label "Inches";
- menuItem -label "Feet";
- menuItem -label "Miles";
- menuItem -label "Millimeters";
- menuItem -label "Centimeters";
- menuItem -label "Meters";
- menuItem -label "Kilometers";
- menuItem -label "Microinches";
- menuItem -label "Miles";
- menuItem -label "Yards";
- menuItem -label "Angstroms";
- menuItem -label "Nanometers";
- menuItem -label "Microns";
- menuItem -label "Decimeters";
- menuItem -label "Decameters";
- menuItem -label "Hectometers";
- menuItem -label "Gigameters";
- menuItem -label "Astronomical units";
- menuItem -label "Light years";
- menuItem -label "Parsecs";
-
-
- //space
- text -label "";
-
-
- rowLayout -numberOfColumns 2;
- text -label "Scale factor";
- floatField -minValue 0 -maxValue 10000 -precision 4 -value 1 scaleField;
- setParent ..;
-
- //space
- text -label "";
-
- //____________________________________________________________________________________
-
- text -label "Polygon Mesh Options" -fn "boldLabelFont" -w 200 -al "left";
-
- text -label "";
-
- rowLayout -numberOfColumns 2;
- text -label "Tessellation";
- columnLayout;
- radioCollection odwgExportCollection;
- radioButton -label "No tessellation" -align "right" noTessellate;
- radioButton -label "Triangulate" -align "right" triangulate;
- radioButton -label "Quadrangulate" -align "right" quadrangulate;
- setParent ..;
- setParent ..;
-
- //space
- text -label "";
-
-
-
- rowLayout -numberOfColumns 2;
-
- text -label "Export as";
- columnLayout;
- radioCollection odwgExportPolygonFormat;
- radioButton -label "Polyface Mesh" -align "left" polyface;
- radioButton -label "Separate Polyfaces" -align "left" sepPolyface;
- radioButton -label "3D Faces" -align "left" face;
- setParent ..;
- setParent ..;
-
- //space
- text -label "";
-
-
-
-
- // set defaults
- //_______________________________________________________________________________________
-
-
-
-
- // N U R B S
-
- text -label "NURBS Surface Tessellation Options" -w 300 -fn "boldLabelFont" -al "left";
- text -label "";
-
- rowLayout -numberOfColumns 2 ;
-
- text -label "Type" ;
-
- columnLayout;
- radioCollection odwgNurbSurfTesselation;
- radioButton -label "Triangulate" -align "right" nurbTriangulate;
- radioButton -label "Quadrangulate" -align "right" nurbQuadrangulate;
- setParent ..;
- setParent ..;
-
- //space
- text -label "";
-
-
- rowLayout -numberOfColumns 2 ;
-
- text -label "Method" -align "left";
-
- columnLayout;
- radioCollection tessMethod;
- radioButton -label "General" -align "left" -cc ("nurbsToPolyVis " + $parent + " 0") general ;
- radioButton -label "Standard Fit" -align "left" -cc ("nurbsToPolyVis " + $parent + " 1") standard ;
- radioButton -label "Count" -align "left" -cc ("nurbsToPolyVis " + $parent + " 2") count;
- setParent ..;
- setParent ..;
-
- //space
- text -label "";
-
- //____________________________________________________________________________________
-
-
- tabLayout -tabsVisible false formatTabs;
-
- columnLayout tabGeneral;
-
- text -l " Initial Tessellation Controls" -align "left";
-
- // U-Type
- optionMenuGrp -l "U Type" uType;
- menuItem -l "Per Surf # of Iso Params in 3D";
- menuItem -l "Per Surf # of Iso Params";
- menuItem -l "Per Span # of Iso Params";
-
- intSliderGrp -label "Number U" -min 1 -max 32 -fmx 10000 -f true uNumber;
-
-
- //space
- text -label "";
-
-
-
- // V-Type
-
- optionMenuGrp -l "V Type" vType;
- menuItem -l "Per Surf # of Iso Params in 3D";
- menuItem -l "Per Surf # of Iso Params";
- menuItem -l "Per Span # of Iso Params";
-
- intSliderGrp -label "Number V" -min 1 -max 32 -fmx 10000 -f true vNumber;
-
- setParent ..;
-
-
- //_______________________________________________________________________________
-
- columnLayout tabStandard;
- floatSliderGrp -l "Chord Height Ratio" -min 0.01 -max 0.2 -f true -pre 3 -s 0.01 ratioS;
- floatSliderGrp -l "Fractional Tolerance"-min 0.001 -max 1.0 -fmn 0.000001 -fmx 1.0 -f true -pre 4 -s 0.001 fractional;
- floatSliderGrp -l "Minimal Edge Length" -min 0.0001 -max 1.0 -f true -pre 4 -s 0.001 minEdgeLength;
- floatSliderGrp -l "3D Delta" -min 0.01 -max 1.0 -fmn 0.001 -fmx 1.0 -f true -pre 4 -s 0.001 delta;
- setParent ..;
-
- //____________________________________________________________________________________
-
- columnLayout tabCount;
- intSliderGrp -label "Count" -f true -min 1 -max 1000 -fmx 1000000 gCount;
- setParent ..;
-
- //____________________________________________________________________________________
-
- columnLayout tabNothing;
- setParent ..;
- setParent ..;
-
-
- columnLayout;
- text -label "";
- text -label "";
- button -l "Restore Defaults" -al "center" -c restoreDefaultOptions -w 150 -h 30 restoreDefaultsButton;
- setParent ..;
-
- restoreDefaultOptions;
-
- //______________________________________________________________________________________
-
-
- // Now set to current settings.
-
- $currentOptions = $initialSettings;
-
-
-
- if (size($currentOptions) > 0) {
- tokenize($currentOptions, ";", $optionList);
-
- for ($index = 0; $index < size($optionList); $index++) {
- tokenize($optionList[$index], "=", $optionBreakDown);
-
- if ($optionBreakDown[0] == "tessellate") {
- if ($optionBreakDown[1] == "0") {
- radioButton -e -sl noTessellate;
- } else if ($optionBreakDown[1] == "1") {
- radioButton -e -sl triangulate;
- } else if ($optionBreakDown[1] == "2") {
- radioButton -e -sl quadrangulate;
- }
- } else if ($optionBreakDown[0] == "fileVersion") {
- // these 2 line are causing trouble.
- int $fileVersionInt = $optionBreakDown[1];
- optionMenuGrp -e -sl $fileVersionInt fileVersion;
- } else if ($optionBreakDown[0] == "scale") {
- float $scaleFloat = $optionBreakDown[1];
- floatField -e -value $scaleFloat scaleField;
- } else if ($optionBreakDown[0] == "units") {
- int $unitsInt = $optionBreakDown[1];
- optionMenuGrp -e -sl $unitsInt units;
- } else if ($optionBreakDown[0] == "polyFormat") {
- if ($optionBreakDown[1] == "0") {
- radioButton -e -sl polyface;
- }else if ($optionBreakDown[1] == "1") {
- radioButton -e -sl sepPolyface;
- }else if ($optionBreakDown[1] == "2") {
- radioButton -e -sl face;
- }
- }
- }
- }
- $result = 1;
-
-
-
- } else if ($action == "query") {
-
- if (`radioButton -q -sl noTessellate` == 1) {
- $currentOptions = $currentOptions + "tessellate=0";
- } else if (`radioButton -q -sl triangulate` == 1) {
- $currentOptions = $currentOptions + "tessellate=1";
- } else {
- $currentOptions = $currentOptions + "tessellate=2";
- }
-
-
- $fileVersionInt = `optionMenuGrp -q -sl fileVersion`;
- $currentOptions = $currentOptions + ";fileVersion=" + $fileVersionInt;
-
-
- $currentOptions = $currentOptions + ";scale=" + (`floatField -q -v scaleField`);
-
- int $unitsInt = `optionMenuGrp -q -sl units`;
- $currentOptions = $currentOptions + ";units=" + $unitsInt;
-
- if (`radioButton -q -sl polyface` == 1) {
- $currentOptions = $currentOptions + ";polyFormat=0";
- } else if (`radioButton -q -sl sepPolyface` == 1) {
- $currentOptions = $currentOptions + ";polyFormat=1";
- } else if (`radioButton -q -sl face` == 1) {
- $currentOptions = $currentOptions + ";polyFormat=2";
- }
-
-
- //____________________________ nurbs Surface Tessellation
-
- if (`radioButton -q -sl nurbTriangulate` == 1) {
- $currentOptions = $currentOptions + ";nurbSurfTess=0";
- } else if (`radioButton -q -sl nurbQuadrangulate` == 1) {
- $currentOptions = $currentOptions + ";nurbSurfTess=1";
- }
-
-
- if (`radioButton -q -sl standard` == 1) {
- $currentOptions = $currentOptions + ";nurbSurfTessType=standardFit";
- } else if (`radioButton -q -sl general` == 1) {
- $currentOptions = $currentOptions + ";nurbSurfTessType=general";
- } else if (`radioButton -q -sl count` == 1) {
- $currentOptions = $currentOptions + ";nurbSurfTessType=count";
- }
-
-
- //standard-fit data
- $currentOptions = $currentOptions + ";chordHtRatio=" + (`floatSliderGrp -q -v ratioS`);
- $currentOptions = $currentOptions + ";fracTolerance=" + (`floatSliderGrp -q -v fractional`);
- $currentOptions = $currentOptions + ";midEdgeLength=" + (`floatSliderGrp -q -v minEdgeLength`);
- $currentOptions = $currentOptions + ";delta=" + (`floatSliderGrp -q -v delta`);
-
- //general-data
- $currentOptions = $currentOptions + ";count=" + (`intSliderGrp -q -v gCount`);
-
- //count data
- $currentOptions = $currentOptions + ";uType=" + (`optionMenuGrp -q -v uType`);
- $currentOptions = $currentOptions + ";uNumber=" + (`intSliderGrp -q -v uNumber`);
- $currentOptions = $currentOptions + ";vType=" + (`optionMenuGrp -q -v vType`);
- $currentOptions = $currentOptions + ";vNumber=" + (`intSliderGrp -q -v vNumber`);
-
-
-
- eval($resultCallback+" \""+$currentOptions+"\"");
- $result = 1;
- } else {
- $bResult = 0;
- }
-
- return $bResult;
- }
-
-
-
-
-
-
- global proc nurbsToPolyVis( string $parent, int $format )
- {
- setParent $parent;
- switch( $format ) {
- case 0:
- default:
- tabLayout -e -selectTab tabGeneral formatTabs;
- break;
- case 1:
- tabLayout -e -selectTab tabStandard formatTabs;
- break;
- case 2:
- tabLayout -e -selectTab tabCount formatTabs;
- break;
- case 3:
- tabLayout -e -selectTab tabNothing formatTabs;
- break;
- }
-
-
- }
-
-
- global proc restoreDefaultOptions ()
- {
- optionMenuGrp -e -v "ACAD2000" fileVersion;
-
- optionMenuGrp -e -en true units;
- optionMenuGrp -e -v "Centimeters" units;
-
- floatField -e -v 1.00 scaleField;
- radioCollection -e -sl noTessellate odwgExportCollection;
- radioCollection -e -sl polyface odwgExportPolygonFormat;
-
- radioCollection -e -sl nurbQuadrangulate odwgNurbSurfTesselation;
-
- radioCollection -e -sl standard tessMethod;
-
- floatSliderGrp -e -v 0.1 ratioS;
- floatSliderGrp -e -v 0.01 fractional;
- floatSliderGrp -e -v 0.001 minEdgeLength;
- floatSliderGrp -e -v 0.1 delta;
-
-
- optionMenuGrp -e -v "Per Surf # of Iso Params in 3D" uType;
- optionMenuGrp -e -v "Per Surf # of Iso Params in 3D" vType;
- intSliderGrp -e -v 3 uNumber;
- intSliderGrp -e -v 3 vNumber;
-
- intSliderGrp -e -v 200 gCount;
-
- }
-
-
- global proc updatedwgUnitsEnabled()
- {
- if (`optionMenuGrp -q -v fileVersion` == "ACAD2000")
- {
- optionMenuGrp -e -en true units;
- }
- else
- {
- optionMenuGrp -e -en false units;
- }
- }
-
-